<?php
/**
 * Local Disk Container.
 * @package safsi_localdisk
 */

require_once('safsi_IContainer.php');
require_once('safsi_localdisk_FileSystem.php');
require_once('safsi_localdisk_Object.php');

/**
 * Local Disk Container.
 * @package safsi_localdisk
 */
class safsi_localdisk_Container implements safsi_IContainer {

    /**
     * File System.
     * @var safsi_localdisk_FileSystem
     */
    private $fileSystem;

    /**
     * Name for this container.
     * @var string
     */
    private $name;

    /**
     * Create a new container.
     * @param safsi_localdisk_FileSystem $fileSystem File System.
     * @param string $name Name for this container.
     */
    public function __construct(safsi_localdisk_FileSystem $fileSystem, $name) {
        $this->fileSystem = $fileSystem;
        $this->name = $name;
    }

    /**
     * Get the container's name.
     * @return string Name
     */
    public function name() {
        return $this->name;
    }

    /**
     * Deletes a safsi_IObject.
     * @param mixed $object Name of object or a safsi_IObject instance
     */
    public function deleteObject($object) {
        throw new safsi_exception_NotImplementedException(
            'delete object'
        );
    }

    /**
     * Gets a safsi_IObject.
     * @param mixed $object Name of object or a safsi_IObject instance
     * @return safsi_IObject
     */
    public function getObject($object) {
        return new safsi_localdisk_Object($this->fileSystem, $this, $object);
    }

    public function constructPath(safsi_localdisk_Object $object = null) {
        return $this->fileSystem->constructPath($this, $object);
    }

    public function constructPathToObject(safsi_localdisk_Object $object = null) {
        return $this->fileSystem->constructPathToObject($this, $object);
    }

    public function constructObjectFileName(safsi_localdisk_Object $object = null) {
        return $this->fileSystem->constructObjectFileName($object);
    }

    public function mkDir($parts) {
        return $this->fileSystem->mkDir($parts);
    }

}

?>
